package com.southwind.aspect;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by chenhs on 2018/6/22.
 */
public class TestCalService {
    public static void main(String[] args) {

    /*    //普通aop实现方式
        CalService cal = new CalServiceImpl();

        MyInvocationHandler mh = new MyInvocationHandler();
        CalService cal2 = (CalService) mh.bind(cal);
        cal2.add(10, 3);
        cal2.sub(10, 3);
        cal2.mul(10, 3);
        cal2.div(10, 3);
        */

        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("common-beans.xml");
        CalService cal = (CalService) applicationContext.getBean("calServiceImpl");
        cal.add(10, 3);
        cal.sub(10, 3);
        cal.mul(10, 3);
        cal.div(10, 3);
    }
}
